Skip to content

feat(cmd): print name, version, commit, and date from --version - #45

Merged
willkg merged 1 commit into
mainfrom
version-format
Jul 23, 2026
Merged

feat(cmd): print name, version, commit, and date from --version#45
willkg merged 1 commit into
mainfrom
version-format

Conversation

@willkg

@willkg willkg commented Jul 23, 2026

Copy link
Copy Markdown
Member

Makes markfluence --version print a proper build stamp and unifies it with the <!-- markfluence-version --> token embedded in published pages — both now emit the same string.

Before / after

# before
markfluence version dev

# after (stamped release build)
markfluence 1.5.0 (73692dc, 2026-07-23)

# after (dev build)
markfluence dev (73692dc, 2026-07-23)

What changed

  • Format: markfluence VERSION (SHA, DATE) — a compact, parenthesized form. It adds the short vcs.revision commit hash (the standard build identifier) next to the commit date, and drops the trailing unlabeled timestamp of the old markfluence vVERSION COMMITDATE shape. The hash and date are each omitted when the toolchain hasn't embedded VCS info; the parenthetical drops entirely if both are missing.
  • Unified with the embedded token: Stamp() is the single source for both --version and the converter's <!-- markfluence-version --> substitution, so they can't diverge.
  • internal/buildinfo: adds Revision() (short vcs.revision) and a setting() helper; removes the now-unused CommitDate(); adds tests for the date trimming and the stamp prefix.
  • cmd/root.go: sets a {{.Version}} version template so the stamp (which already carries the markfluence prefix) prints verbatim rather than inside cobra's markfluence version <...> wrapper.

The converter's token-substitution test is unaffected (it passes its own literal stamp). make test && make lint && make vet all green.

Make `markfluence --version` emit a build stamp instead of cobra's
default "markfluence version <...>" wrapper, and unify it with the
<!-- markfluence-version --> token the converter embeds in published
pages so both print the same string.

The stamp is now "markfluence VERSION (SHA, DATE)" — a compact,
parenthesized form that adds the short vcs.revision commit hash (the
standard build identifier) alongside the commit date. The hash and date
are each omitted when the toolchain hasn't embedded VCS info, and the
parenthetical drops entirely if both are missing.

buildinfo gains Revision() and a setting() helper; the now-unused
CommitDate() is removed. root.go sets a {{.Version}} version template so
the stamp (which already carries the "markfluence" prefix) prints
verbatim.
@willkg
willkg merged commit 16645b5 into main Jul 23, 2026
1 check passed
@willkg
willkg deleted the version-format branch July 23, 2026 20:20
willkg added a commit that referenced this pull request Jul 23, 2026
Reflect the new build stamp (markfluence VERSION (SHA, DATE)) that
landed in #45; note it matches `markfluence --version`.
willkg added a commit that referenced this pull request Jul 23, 2026
Reflect the new build stamp (markfluence VERSION (SHA, DATE)) that
landed in #45; note it matches `markfluence --version`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant